import React, { Component, PropTypes } from 'react';
import { Form, Icon, Input, Select, Button, Checkbox, message } from 'antd';
import Md5 from 'js-md5';
import { connect } from 'dva'
import Style from './index.less';
import Service from '../service';

const FormItem = Form.Item;
var map, point;

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
      account: ''
    }
  }
  componentDidMount() {
    let self = this;
    const account = localStorage.getItem('account');
    self.setState({
      account: account
    })
    // this.props.queryStatistics({ token: token })
    // this.entityListFun();

  }
  componentWillUnmount() {
    let self = this;
    self.props.urlStatus({
      url: '/umy'
    });
  }


  // 返回
  returnFun = () => {
    this.context.router.push(`/usearchnumber`);
  }
  // 拒签
  videoListUrlFun = () => {
    this.context.router.push(`/uvideolist`);
  }

  render() {
    const { getFieldDecorator } = this.props.form;
    const { account } = this.state;
    return (
      <div className={Style.wrap}>
        <div className={Style.headWrap}>
          <div className={Style.navTitle}>
            <span className={Style.arrow} onClick={this.returnFun}>
              <Icon type="left" />
            </span>
            我的
          </div>
        </div>
        <div className={Style.dataWrap}>
          <ul className={Style.myList}>
            <li>账号：{account}</li>
            <li onClick={this.videoListUrlFun}><span className={Style.iconLeft}><Icon type="video-camera" /></span>签收视频
              <span className={Style.ri}><Icon type="right" /></span>
            </li>
          </ul>
        </div>
      </div>
    )
  }
}

App.contextTypes = {
  router: React.PropTypes.object
}

function mapStateToProps(state, ownProps) {
  return {
    userMsg: state.login.userMsg,
    data: state.login.data.data
  }
}
function dispatchToProps(dispatch) {
  return {
    saveUser(payload, params) {
      dispatch({
        type: 'login/saveUser',
        payload
      })
    },
    queryUser(payload, params) {
      dispatch({
        type: 'register/queryUser',
        payload
      })
    },
    querySendCode(payload, params) {
      dispatch({
        type: 'register/sendCode',
        payload
      })
    },
    urlStatus(payload, params) {
      dispatch({
        type: 'myHome/urlStatus',
        payload
      })
    }
  }
}
export default connect(mapStateToProps, dispatchToProps)(Form.create()(App));
